home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
201-225
/
disk_218
/
edlib
/
toint.c
< prev
Wrap
Text File
|
1992-05-06
|
671b
|
25 lines
/*
* edlib v1.1 Copyright 1989 Edwin Hoogerbeets
* This code is freely redistributable as long as no charge other than
* reasonable copying fees are levied for it.
*/
/*
toint is also not included in Manx. converts an ascii character
into its corresponding hexadecimal value. Can be used for
binary and decimal digits since these are subsets of the
hexadecimal character set.
*/
int toint(c)
register char c;
{
if ( c >= '0' && c <= '9') {
return( c - '0' );
} else if ( c >= 'a' && c <= 'f' ) {
return( c - 'a' + 10 );
} else if ( c >= 'A' && c <= 'F' ) {
return( c - 'A' + 10 );
} else
return(-1);
}